{% load static thumbnail %}

<div class="row answer" answer-id="{{ answer.uuid_id }}">
    {% csrf_token %}
    <div class="col-md-1 options">
        <i class="fa fa-chevron-up vote up-vote answer-vote {% if request.user in answer.get_upvoters %}voted{% endif %}" aria-hidden="true"
           title="单击赞同，再次点击取消"></i>
        <span id="answerVotes" class="votes">{{ answer.total_votes }}</span>
        <i class="fa fa-chevron-down vote down-vote answer-vote {% if request.user in answer.get_downvoters %}voted{% endif %}" aria-hidden="true"
           title="单击反对，再次点击取消"></i>
        <!--自己提的问题显示是否接受回答的按钮-->
        {% if answer.is_answer %}
            <i class="fa fa-check accept accepted" aria-hidden="true" title="此回答已被采纳"></i>
        {% elif not answer.is_answer and user.username == question.user.username %}
            <i id="acceptAnswer" class="fa fa-check accept" aria-hidden="true" title="点击采纳回答"></i>
        {% endif %}
    </div>
    <div class="col-md-11">
        <div class="answer-user">
            <div class="profile-picture">
                {% thumbnail answer.user.picture "x50" as im %}
                    <img src="{{ im.url }}" class="user-image" style="border-radius: 50%;" alt="用户头像">
                {% empty %}
                    <img src="{% static 'images/user.png' %}" class="pull-left" height="50px" alt="没有头像"/>
                {% endthumbnail %}
                <a href="{% url 'users:detail' answer.user.username %}" class="username">{{ answer.user.get_profile_name }}</a>
                <small class="answered">回答于 {{ answer.created_at|timesince }}之前</small>
            </div>
        </div>
        <div class="answer-description">
            {{ answer.get_markdown|safe }}
        </div>
    </div>
</div>
<hr>
